
use  "C:\Users\dtingley\Dropbox\XuMilnerTingley\data\MasterDataSetup2014_working.dta", clear

*table 1
estimates clear
logit pol_res chgyrunrat security  rec_comprate , robust
est store m1
xi: logit pol_res chgyrunrat security  rec_comprate i.year , robust
est store m2
logit pol_res chgyrunrat security  rec_comprate GovtOwned t1size , robust
est store m3
xi: logit pol_res chgyrunrat security  rec_comprate GovtOwned t1size i.year , robust
est store m4
gen GovtOwned2=GovtOwned
replace GovtOwned2=0 if GovtOwned==.
logit pol_res chgyrunrat security  rec_comprate GovtOwned2 t1size , robust
est store m5
xi: logit pol_res chgyrunrat security  rec_comprate GovtOwned2 t1size  i.year, robust
est store m6
local order "order( security chgyrunrat rec_comprate)"
*esta m* using "MNA-Reg.tex" , fragment    `order'  starlevels(+ 0.10 * 0.05 ** 0.01)  se drop(_* ) nom nonum nodep nogaps  b(a3)  label brackets  compress replace

*table 2
estimates clear
reg pol_res chgyrunrat security  rec_comprate , robust
est store m1
xi: reg pol_res chgyrunrat security  rec_comprate i.year , robust
est store m2
reg pol_res chgyrunrat security  rec_comprate GovtOwned t1size , robust
est store m3
xi: reg pol_res chgyrunrat security  rec_comprate GovtOwned t1size i.year , robust
est store m4
reg pol_res chgyrunrat security  rec_comprate GovtOwned2 t1size , robust
est store m5
xi: reg pol_res chgyrunrat security  rec_comprate GovtOwned2 t1size  i.year, robust
est store m6
local order "order(security chgyrunrat   rec_comprate)"
*esta m* using "MNA-Reg-OLS.tex" , fragment    `order'  starlevels(+ 0.10 * 0.05 ** 0.01)  se drop(_* ) nom nonum nodep nogaps  b(a3)  label brackets  compress replace



*substantive effects
set scheme s1mono
local p "recastci(rarea) ci1opts(fintensity(30))"
logit pol_res chgyrunrat i.security  rec_comprate i.GovtOwned2 i.t1size , robust
summ pol_res if e(sample)==1
summ chgyrunrat, d
margins, at(chgyrunrat==(-4(1)10))
marginsplot, `p'  ytitle("Probability Resistance") title("Effect of Economic Distress")
graph export chgyrunrat.pdf, replace
summ rec_comprate, d
margins, at(rec_comprate==(0(.1)1))
marginsplot,  `p' ytitle("Probability Resistance") title("Effect of Reciprocity")
graph export rec_comprate.pdf, replace
margins security 
marginsplot,  `p' ytitle("Probability Resistance") title("Effect of National Security")
graph export security.pdf, replace
margins GovtOwned2
marginsplot , `p' ytitle("Probability Resistance") xtitle("Government Owned") title("Effect of Gov. Ownership")
graph save govtowned2.gph, replace
margins t1size
marginsplot,   `p' ytitle("Probability Resistance") xtitle("Large Firm") title("Effect of Firm Size")
graph save t1size.gph, replace
graph combine govtowned2.gph t1size.gph, col(2) ycomm
graph export controleffects.pdf, replace



